﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FlexFlow.Base.Interface;
using FlexFlow.Model;

namespace FlexFlow.Runtime.Applications
{
    /// <summary>
    /// 表示起始节点应用程序实现
    /// </summary>
    public class StartActivityApplication : IWorkFlowApplication
    {
        public ApplicationExecuteResult Execute(ApplicationInvokeContext context)
        {
            //将下一个节点定位到接下来的节点集合中的首个元素
            return new ApplicationExecuteResult()
            {
                NextActivityIds = context.NextPaths.Select(m => m.To).ToArray()
            };
        }

        public TaskSubmitResult ProcessTaskSubmit(ApplicationInvokeContext context, WorkFlowTask task)
        {
            throw new Exception("无法提交任务到起始节点中");
        }

        public DataSlot[] GetDataSlots(KeyValuePair<string, string>[] options)
        {
            return new DataSlot[] { };
        }
    }
}
